\(\int \cot (c+d x) (a+i a \tan (c+d x)) (A+B \tan (c+d x)) \, dx\) [4]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [B] (verification not implemented)
   Maxima [A] (verification not implemented)
   Giac [B] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 30, antiderivative size = 40 \[ \int \cot (c+d x) (a+i a \tan (c+d x)) (A+B \tan (c+d x)) \, dx=a (i A+B) x-\frac {i a B \log (\cos (c+d x))}{d}+\frac {a A \log (\sin (c+d x))}{d} \]

[Out]

a*(I*A+B)*x-I*a*B*ln(cos(d*x+c))/d+a*A*ln(sin(d*x+c))/d

Rubi [A] (verified)

Time = 0.08 (sec) , antiderivative size = 40, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 3, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.100, Rules used = {3670, 3556, 3612} \[ \int \cot (c+d x) (a+i a \tan (c+d x)) (A+B \tan (c+d x)) \, dx=a x (B+i A)+\frac {a A \log (\sin (c+d x))}{d}-\frac {i a B \log (\cos (c+d x))}{d} \]

[In]

Int[Cot[c + d*x]*(a + I*a*Tan[c + d*x])*(A + B*Tan[c + d*x]),x]

[Out]

a*(I*A + B)*x - (I*a*B*Log[Cos[c + d*x]])/d + (a*A*Log[Sin[c + d*x]])/d

Rule 3556

Int[tan[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-Log[RemoveContent[Cos[c + d*x], x]]/d, x] /; FreeQ[{c, d}, x]

Rule 3612

Int[((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)])/((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(a*c +
b*d)*(x/(a^2 + b^2)), x] + Dist[(b*c - a*d)/(a^2 + b^2), Int[(b - a*Tan[e + f*x])/(a + b*Tan[e + f*x]), x], x]
 /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0] && NeQ[a^2 + b^2, 0] && NeQ[a*c + b*d, 0]

Rule 3670

Int[(((A_.) + (B_.)*tan[(e_.) + (f_.)*(x_)])*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)]))/((a_.) + (b_.)*tan[(e_.)
 + (f_.)*(x_)]), x_Symbol] :> Dist[B*(d/b), Int[Tan[e + f*x], x], x] + Dist[1/b, Int[Simp[A*b*c + (A*b*d + B*(
b*c - a*d))*Tan[e + f*x], x]/(a + b*Tan[e + f*x]), x], x] /; FreeQ[{a, b, c, d, e, f, A, B}, x] && NeQ[b*c - a
*d, 0]

Rubi steps \begin{align*} \text {integral}& = (i a B) \int \tan (c+d x) \, dx+\int \cot (c+d x) (a A+a (i A+B) \tan (c+d x)) \, dx \\ & = a (i A+B) x-\frac {i a B \log (\cos (c+d x))}{d}+(a A) \int \cot (c+d x) \, dx \\ & = a (i A+B) x-\frac {i a B \log (\cos (c+d x))}{d}+\frac {a A \log (\sin (c+d x))}{d} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.05 (sec) , antiderivative size = 54, normalized size of antiderivative = 1.35 \[ \int \cot (c+d x) (a+i a \tan (c+d x)) (A+B \tan (c+d x)) \, dx=i a A x+a B x+\frac {a A \log (\cos (c+d x))}{d}-\frac {i a B \log (\cos (c+d x))}{d}+\frac {a A \log (\tan (c+d x))}{d} \]

[In]

Integrate[Cot[c + d*x]*(a + I*a*Tan[c + d*x])*(A + B*Tan[c + d*x]),x]

[Out]

I*a*A*x + a*B*x + (a*A*Log[Cos[c + d*x]])/d - (I*a*B*Log[Cos[c + d*x]])/d + (a*A*Log[Tan[c + d*x]])/d

Maple [A] (verified)

Time = 0.56 (sec) , antiderivative size = 43, normalized size of antiderivative = 1.08

method result size
parallelrisch \(\frac {a \left (\left (-\frac {A}{2}+\frac {i B}{2}\right ) \ln \left (\sec ^{2}\left (d x +c \right )\right )+A \ln \left (\tan \left (d x +c \right )\right )+\left (i A +B \right ) x d \right )}{d}\) \(43\)
derivativedivides \(\frac {a \left (\frac {\left (i B -A \right ) \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{2}+\left (i A +B \right ) \arctan \left (\tan \left (d x +c \right )\right )+A \ln \left (\tan \left (d x +c \right )\right )\right )}{d}\) \(51\)
default \(\frac {a \left (\frac {\left (i B -A \right ) \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{2}+\left (i A +B \right ) \arctan \left (\tan \left (d x +c \right )\right )+A \ln \left (\tan \left (d x +c \right )\right )\right )}{d}\) \(51\)
norman \(\left (i a A +B a \right ) x +\frac {a A \ln \left (\tan \left (d x +c \right )\right )}{d}-\frac {\left (-i a B +a A \right ) \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{2 d}\) \(51\)
risch \(-\frac {2 i a A c}{d}-\frac {2 a B c}{d}+\frac {a A \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}-1\right )}{d}-\frac {i a \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right ) B}{d}\) \(57\)

[In]

int(cot(d*x+c)*(a+I*a*tan(d*x+c))*(A+B*tan(d*x+c)),x,method=_RETURNVERBOSE)

[Out]

a*((-1/2*A+1/2*I*B)*ln(sec(d*x+c)^2)+A*ln(tan(d*x+c))+(I*A+B)*x*d)/d

Fricas [A] (verification not implemented)

none

Time = 0.25 (sec) , antiderivative size = 36, normalized size of antiderivative = 0.90 \[ \int \cot (c+d x) (a+i a \tan (c+d x)) (A+B \tan (c+d x)) \, dx=\frac {-i \, B a \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right ) + A a \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} - 1\right )}{d} \]

[In]

integrate(cot(d*x+c)*(a+I*a*tan(d*x+c))*(A+B*tan(d*x+c)),x, algorithm="fricas")

[Out]

(-I*B*a*log(e^(2*I*d*x + 2*I*c) + 1) + A*a*log(e^(2*I*d*x + 2*I*c) - 1))/d

Sympy [B] (verification not implemented)

Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 94 vs. \(2 (36) = 72\).

Time = 1.03 (sec) , antiderivative size = 94, normalized size of antiderivative = 2.35 \[ \int \cot (c+d x) (a+i a \tan (c+d x)) (A+B \tan (c+d x)) \, dx=\frac {A a \log {\left (\frac {- A a - i B a}{A a e^{2 i c} + i B a e^{2 i c}} + e^{2 i d x} \right )}}{d} - \frac {i B a \log {\left (\frac {A a + i B a}{A a e^{2 i c} + i B a e^{2 i c}} + e^{2 i d x} \right )}}{d} \]

[In]

integrate(cot(d*x+c)*(a+I*a*tan(d*x+c))*(A+B*tan(d*x+c)),x)

[Out]

A*a*log((-A*a - I*B*a)/(A*a*exp(2*I*c) + I*B*a*exp(2*I*c)) + exp(2*I*d*x))/d - I*B*a*log((A*a + I*B*a)/(A*a*ex
p(2*I*c) + I*B*a*exp(2*I*c)) + exp(2*I*d*x))/d

Maxima [A] (verification not implemented)

none

Time = 0.30 (sec) , antiderivative size = 49, normalized size of antiderivative = 1.22 \[ \int \cot (c+d x) (a+i a \tan (c+d x)) (A+B \tan (c+d x)) \, dx=\frac {2 \, {\left (d x + c\right )} {\left (i \, A + B\right )} a - {\left (A - i \, B\right )} a \log \left (\tan \left (d x + c\right )^{2} + 1\right ) + 2 \, A a \log \left (\tan \left (d x + c\right )\right )}{2 \, d} \]

[In]

integrate(cot(d*x+c)*(a+I*a*tan(d*x+c))*(A+B*tan(d*x+c)),x, algorithm="maxima")

[Out]

1/2*(2*(d*x + c)*(I*A + B)*a - (A - I*B)*a*log(tan(d*x + c)^2 + 1) + 2*A*a*log(tan(d*x + c)))/d

Giac [B] (verification not implemented)

Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 74 vs. \(2 (36) = 72\).

Time = 0.40 (sec) , antiderivative size = 74, normalized size of antiderivative = 1.85 \[ \int \cot (c+d x) (a+i a \tan (c+d x)) (A+B \tan (c+d x)) \, dx=-\frac {i \, B a \log \left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 1\right ) + i \, B a \log \left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 1\right ) - A a \log \left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )\right ) + 2 \, {\left (A a - i \, B a\right )} \log \left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + i\right )}{d} \]

[In]

integrate(cot(d*x+c)*(a+I*a*tan(d*x+c))*(A+B*tan(d*x+c)),x, algorithm="giac")

[Out]

-(I*B*a*log(tan(1/2*d*x + 1/2*c) + 1) + I*B*a*log(tan(1/2*d*x + 1/2*c) - 1) - A*a*log(tan(1/2*d*x + 1/2*c)) +
2*(A*a - I*B*a)*log(tan(1/2*d*x + 1/2*c) + I))/d

Mupad [B] (verification not implemented)

Time = 7.70 (sec) , antiderivative size = 36, normalized size of antiderivative = 0.90 \[ \int \cot (c+d x) (a+i a \tan (c+d x)) (A+B \tan (c+d x)) \, dx=\frac {A\,a\,\ln \left (\mathrm {tan}\left (c+d\,x\right )\right )}{d}-\frac {a\,\ln \left (\mathrm {tan}\left (c+d\,x\right )+1{}\mathrm {i}\right )\,\left (A-B\,1{}\mathrm {i}\right )}{d} \]

[In]

int(cot(c + d*x)*(A + B*tan(c + d*x))*(a + a*tan(c + d*x)*1i),x)

[Out]

(A*a*log(tan(c + d*x)))/d - (a*log(tan(c + d*x) + 1i)*(A - B*1i))/d